/*
 * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <tencentcloud/cwp/v20180228/model/DescribeScanMalwareScheduleResponse.h>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>

using TencentCloud::CoreInternalOutcome;
using namespace TencentCloud::Cwp::V20180228::Model;
using namespace rapidjson;
using namespace std;

DescribeScanMalwareScheduleResponse::DescribeScanMalwareScheduleResponse() :
    m_scheduleHasBeenSet(false),
    m_riskFileNumberHasBeenSet(false),
    m_isScheduleHasBeenSet(false),
    m_scanStatusHasBeenSet(false)
{
}

CoreInternalOutcome DescribeScanMalwareScheduleResponse::Deserialize(const string &payload)
{
    Document d;
    d.Parse(payload.c_str());
    if (d.HasParseError() || !d.IsObject())
    {
        return CoreInternalOutcome(Error("response not json format"));
    }
    if (!d.HasMember("Response") || !d["Response"].IsObject())
    {
        return CoreInternalOutcome(Error("response `Response` is null or not object"));
    }
    Value &rsp = d["Response"];
    if (!rsp.HasMember("RequestId") || !rsp["RequestId"].IsString())
    {
        return CoreInternalOutcome(Error("response `Response.RequestId` is null or not string"));
    }
    string requestId(rsp["RequestId"].GetString());
    SetRequestId(requestId);

    if (rsp.HasMember("Error"))
    {
        if (!rsp["Error"].IsObject() ||
            !rsp["Error"].HasMember("Code") || !rsp["Error"]["Code"].IsString() ||
            !rsp["Error"].HasMember("Message") || !rsp["Error"]["Message"].IsString())
        {
            return CoreInternalOutcome(Error("response `Response.Error` format error").SetRequestId(requestId));
        }
        string errorCode(rsp["Error"]["Code"].GetString());
        string errorMsg(rsp["Error"]["Message"].GetString());
        return CoreInternalOutcome(Error(errorCode, errorMsg).SetRequestId(requestId));
    }


    if (rsp.HasMember("Schedule") && !rsp["Schedule"].IsNull())
    {
        if (!rsp["Schedule"].IsInt64())
        {
            return CoreInternalOutcome(Error("response `Schedule` IsInt64=false incorrectly").SetRequestId(requestId));
        }
        m_schedule = rsp["Schedule"].GetInt64();
        m_scheduleHasBeenSet = true;
    }

    if (rsp.HasMember("RiskFileNumber") && !rsp["RiskFileNumber"].IsNull())
    {
        if (!rsp["RiskFileNumber"].IsInt64())
        {
            return CoreInternalOutcome(Error("response `RiskFileNumber` IsInt64=false incorrectly").SetRequestId(requestId));
        }
        m_riskFileNumber = rsp["RiskFileNumber"].GetInt64();
        m_riskFileNumberHasBeenSet = true;
    }

    if (rsp.HasMember("IsSchedule") && !rsp["IsSchedule"].IsNull())
    {
        if (!rsp["IsSchedule"].IsBool())
        {
            return CoreInternalOutcome(Error("response `IsSchedule` IsBool=false incorrectly").SetRequestId(requestId));
        }
        m_isSchedule = rsp["IsSchedule"].GetBool();
        m_isScheduleHasBeenSet = true;
    }

    if (rsp.HasMember("ScanStatus") && !rsp["ScanStatus"].IsNull())
    {
        if (!rsp["ScanStatus"].IsUint64())
        {
            return CoreInternalOutcome(Error("response `ScanStatus` IsUint64=false incorrectly").SetRequestId(requestId));
        }
        m_scanStatus = rsp["ScanStatus"].GetUint64();
        m_scanStatusHasBeenSet = true;
    }


    return CoreInternalOutcome(true);
}


int64_t DescribeScanMalwareScheduleResponse::GetSchedule() const
{
    return m_schedule;
}

bool DescribeScanMalwareScheduleResponse::ScheduleHasBeenSet() const
{
    return m_scheduleHasBeenSet;
}

int64_t DescribeScanMalwareScheduleResponse::GetRiskFileNumber() const
{
    return m_riskFileNumber;
}

bool DescribeScanMalwareScheduleResponse::RiskFileNumberHasBeenSet() const
{
    return m_riskFileNumberHasBeenSet;
}

bool DescribeScanMalwareScheduleResponse::GetIsSchedule() const
{
    return m_isSchedule;
}

bool DescribeScanMalwareScheduleResponse::IsScheduleHasBeenSet() const
{
    return m_isScheduleHasBeenSet;
}

uint64_t DescribeScanMalwareScheduleResponse::GetScanStatus() const
{
    return m_scanStatus;
}

bool DescribeScanMalwareScheduleResponse::ScanStatusHasBeenSet() const
{
    return m_scanStatusHasBeenSet;
}


